Table of Contents Previous Section

Writing Hello World

Writing a WebObjects application involves creating a component for each page in the application and installing the components in a directory that's accessible to WebObjects and your Web server.

Hello World has two components---Main and Hello. The component for the first page of a WebObjects application is always named Main. When a user opens the URL for a WebObjects application, the DefaultApp program looks for a component named Main to represent the first page.

Generally, all the components for an application are installed in a single application directory anywhere in <DocumentRoot>/WebObjects. For example, the Hello World application directory is <DocumentRoot>/WebObjects/Examples/HelloWorld.

The only components that might not be installed in an application directory are reusable components used by multiple applications. These reusable components are installed directly under <DocumentRoot>/WebObjects so all applications can access them. Hello World doesn't use any reusable components, so all its components are installed in <DocumentRoot>/WebObjects/Examples/HelloWorld.

Note: In addition to components, some applications have an application script that creates and manages application-wide resources. Application scripts are installed directly under the application directory and have the name Application.wos. For example, if Hello World had an application script, it would go in the directory <DocumentRoot>/WebObjects/Examples/HelloWorld. For more information on application scripts, see The Role of Scripts in a WebObjects Application.

A component is represented with a component directory that contains an HTML template, a WebScript file, and a declarations file. In addition to these three files, a component directory may also contain images and other resources used by the component.

The following sections describe the files for the Main and Hello components of the Hello World application.

Table of Contents Next Section